from datetime import datetime

FOLD = 'fold'
BET = 'bet'
CALL = 'call'

class Hand:
    
    def __init__(self, id=1, table_name='name',
            date_time=datetime.now(), sb=1, bb=2,
            dealt=None, players=None, actions=None):
        self.id = id
        self.table_name = table_name
        self.date_time = date_time
        self.sb = sb
        self.bb = bb
        if dealt is None:
            dealt = []
        if players is None:
            players = []
        if actions is None:
            actions = []        
        self.players = players
        self.dealt = dealt        
        self.actions = actions       
    
    def addaction(self, action=(FOLD,0)):
        self.actions.append(action)
    
    def addplayer(self, player=('player',0)):
        self.players.append(player)
        
    def __str__(self):
        attrib_list = [attrib for attrib in dir(self) if
                       not callable(getattr(self,attrib)) and
                       not attrib.endswith('__')]                 
        return ''.join([(attrib + ': ' + 
                         str(getattr(self,attrib)) + '\n') 
                         for attrib in attrib_list])